package eirkdbd.lab1.log.model;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import eirkdbd.lab1.obj.Function;


public class FunctionsModel implements TableModel<Function> {

	private static FunctionsModel model = new FunctionsModel();
	
	private Map<String, Function> functions;
	
	private FunctionsModel() {
		functions = new HashMap<String, Function>();
	}
	
	public static FunctionsModel getInstance() {
		return model;
	}
	
	public Iterator<Function> getModelObjects() {
		return functions.values().iterator();
	}
	
	public void clear() {
		functions.clear();
	}
	
	public void add(Function obj) {
		if(obj != null)
			functions.put(obj.getName(), obj);
	}
}